package com.yanqu.road.entity.activity.hsisland.data;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.DataStatus;
import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.entity.union.UnionBaseInfo;

@FieldTypeAnnotation(tableName = "t_c_activity_hs_island_union_data")
public class HsIslandUnionData extends DataObject {

    @FieldTypeAnnotation(desc = "活动ID", select = true, update = true)
    private int activityId;

    @FieldTypeAnnotation(desc = "分组ID", select = true, update = true)
    private int groupId;

    @FieldTypeAnnotation(desc = "商会ID", select = true, update = true)
    private String unionId;

    @FieldTypeAnnotation(desc = "最高海域")
    private int maxFloorId;

    @FieldTypeAnnotation(desc = "船等级")
    private int level;

    @FieldTypeAnnotation(desc = "经验")
    private long exp;

    @FieldTypeAnnotation(desc = "总双倍捐献次数")
    private int dAllDonateNum;

    @FieldTypeAnnotation(desc = "可用双倍捐献次数")
    private int dUsableDonateNum;

    @FieldTypeAnnotation(desc = "创建时间")
    private long createTime;

    public HsIslandUnionData() {
    }

    public HsIslandUnionData(int activityId, int groupId, String unionId, int dAllDonateNum, int dUsableDonateNum) {
        this.activityId = activityId;
        this.groupId = groupId;
        this.unionId = unionId;
        this.maxFloorId = 1;
        this.level = 1;
        this.exp = 0;
        this.dAllDonateNum = dAllDonateNum;
        this.dUsableDonateNum = dUsableDonateNum;
        this.createTime = System.currentTimeMillis();
        setInsertOption();
    }

    public int getActivityId() {
        return activityId;
    }
    public void setActivityId(int activityId) {
        if (this.activityId != activityId) {
            this.activityId = activityId;
            setOp(DataStatus.Update);
        }
    }

    public int getGroupId() {
        return groupId;
    }
    public void setGroupId(int groupId) {
        if (this.groupId != groupId) {
            this.groupId = groupId;
            setOp(DataStatus.Update);
        }
    }

    public String getUnionId() {
        return unionId;
    }
    public void setUnionId(String unionId) {
        if (unionId == null){
            return;
        }
        if (this.unionId == null || !this.unionId.equals(unionId)) {
            this.unionId = unionId;
            setOp(DataStatus.Update);
        }
    }

    public int getMaxFloorId() {
        return maxFloorId;
    }

    public void setMaxFloorId(int maxFloorId) {
        if (this.maxFloorId != maxFloorId) {
            this.maxFloorId = maxFloorId;
            setOp(DataStatus.Update);
        }
    }

    public int getLevel() {
        return level;
    }
    public void setLevel(int level) {
        if (this.level != level) {
            this.level = level;
            setOp(DataStatus.Update);
        }
    }

    public long getExp() {
        return exp;
    }
    public void setExp(long exp) {
        if (this.exp != exp) {
            this.exp = exp;
            setOp(DataStatus.Update);
        }
    }

    public int getDAllDonateNum() {
        return dAllDonateNum;
    }

    public void setDAllDonateNum(int dAllDonateNum) {
        if (this.dAllDonateNum != dAllDonateNum) {
            this.dAllDonateNum = dAllDonateNum;
            setOp(DataStatus.Update);
        }
    }

    public int getDUsableDonateNum() {
        return dUsableDonateNum;
    }

    public void setDUsableDonateNum(int dUsableDonateNum) {
        if (this.dUsableDonateNum != dUsableDonateNum) {
            this.dUsableDonateNum = dUsableDonateNum;
            setOp(DataStatus.Update);
        }
    }

    /**
     * 增加捐献双倍次数
     * @param num
     */
    public synchronized void addDUsableDonateNum(int num) {
        this.dUsableDonateNum += num;
    }

    public long getCreateTime() {
        return createTime;
    }
    public void setCreateTime(long createTime) {
        if (this.createTime != createTime) {
            this.createTime = createTime;
            setOp(DataStatus.Update);
        }
    }
}
